package com.QSMoney.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import org.springframework.format.annotation.DateTimeFormat;

import java.io.Serial;
import java.util.Date;


//让子类的equals/hashCode方法包含父类字段（否则默认只比较子类自身字段）
@EqualsAndHashCode(callSuper = true)
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@TableName("transactions")
/**
 * 交易记录
 */
public class transactions extends BaseEntity {
    @Serial
    private static final long serialVersionUID = 2L;
    /**
     * '交易记录id主键'
     */
    @TableId(type = IdType.AUTO)
    @Schema(description = "交易记录id主键")
    private Long id;
    @Schema(description = "用户id")
    private Long user_id;
    @Schema(description = "交易类型")
    private String type;
    @Schema(description = "金额")
    private String amount;
    @Schema(description = "交易时间")
    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date transactionDate;
    @Schema(description = "交易描述")
    private String description;
    @Schema(description = "支出类型")
    private String spendType;
}
